from django.conf import settings
import hashlib


def md5(data_string):
    obj = hashlib.md5(settings.SECRET_KEY.encode('utf-8')) # MD5加密加salt噪声，用的setting文件里面的SECRET_KEY
    obj.update(data_string.encode('utf-8'))# .encode('utf-8')转为字节
    password = obj.hexdigest()# 得到密文
    return password
